package com.dx.as.upload;

/**
 * Created by jwaoo on 2017/7/18.
 */

public class DownloadInfo {
//    public int msgId;
    public long progress;
    public long total;
    public OnDownloadListener onDownloadListener;

    public void setOnDownloadListener(OnDownloadListener onDownloadListener) {
        this.onDownloadListener = onDownloadListener;
    }

    public void onDownLoadSuccess(){
        if (onDownloadListener != null) {
            onDownloadListener.onDownSuccess();
            DownloadManager.removeDownload(getMsgId());
        }
    }

    public void onDownLoadFailed(){
        if (onDownloadListener != null) {
            onDownloadListener.onDownloadFailed();
            DownloadManager.removeDownload(getMsgId());
        }
    }

    public int getMsgId(){
        return 0;
    }

    public void onDownProgress(long progress,long total){
        this.progress = progress;
        this.total = total;
        if (onDownloadListener != null) onDownloadListener.onDownProgress(progress,total);
    }

}
